The use of a cache to improve the performance of a computer system is well known in the art. Basically, the cache provides a limited amount of intermediate memory between the central processing unit (CPU) and its external memory, so that the data or instructions that are required by the CPU can first be staged to the cache before it is supplied to the CPU. With the size of the cache large enough to hold a substantive portion of instructions and data required by the CPU in processing a program and with the operating speed of the cache higher than that of the external memory, the time spent by the CPU in waiting for memory access is reduced.
When space is needed in the cache to store a new memory item, for instance, data or instructions, from the external memory, prior art cache memory systems typically use one of several replacement algorithms or schemes used to select an entry to be replaced by the new memory item. The most common of the cache replacement algorithms or schemes is the least recently used (LRU) algorithm. When space is needed in the cache to store a new memory item, the cache memory system chooses a storage location for storing the new memory item. With the LRU algorithm, the cache memory system evicts the oldest (least recently used) memory item. In other words, the new memory item replaces the old memory item because the old memory item has not been accessed by the cache memory system as recently as the other memory items. There is no provision in any of the prior art cache memory systems for locking cache entries and protecting them from replacement.
The ability to lock a cache entry can have many potential advantages. For example, it allows the cache to prevent the replacement of time-critical routines which, although not needed frequently, cannot be afforded to be accessed at the slower operating speed of the external memory.